package com.alstudio.pojo;

import com.alstudio.module.xmpp.protocol.xmpp.data.ALXmppConnectionState;
import com.alstudio.module.xmpp.protocol.xmpp.data.ALXmppEventType;
import com.alstudio.module.xmpp.protocol.xmpp.packact.ALMessage;

/**
 * 此类封装了xmpp数据、事件回调到UI层的数据结构。请根据不同的type，获取不同类型的 数据。
 * 
 * @author alonso lee
 * 
 */
public class ALXmppEvent {

	private boolean result = false;
	/* 此变量用于描述服务器下发的响应码 */
	private int responsCode = 0;
	/* 此变量用于描述服务器下发的jid */
	private String jid = null;
	/* 此变量用于描述服务器下发的密码 */
	private String pwd = null;
	/*此变量用于描述服务器下发的有效token*/
	private String token = null;
	/* 此变量用于描述此对象应用的事件 */
	private ALXmppEventType type;
	/* 此变量用于描述当前连接状态 */ 
	private ALXmppConnectionState newConnectionState;
	/* 此变量用于描述上一连接状态 */
	private ALXmppConnectionState lastConnectionState;
	/* 此变量用于描述错误信息 */
	private String errorMessage = "";
	//
	private ALMessage msg;
	// 被踢下线冲突的id
	private String conflictId;
	// 当前XMPP连接的会话id
	private String curXmppSessionId;
	
	private Object data;
	
	private int intData;
	
	private String strData1;
	private String strData2;
	private String strData3;
	
	public static int RESPONSE_OK = 0;

	public ALXmppEvent(ALXmppEventType type) {
		this.type = type;
	}

	/**
	 * 设定数据类型
	 * 
	 * @param type
	 *            数据类型
	 * @author alonso lee
	 */
	public void setType(ALXmppEventType type) {
		this.type = type;
	}

	/**
	 * 获取数据类型
	 * 
	 * @return 数据类型
	 * @author alonso lee
	 */
	public ALXmppEventType getType() {
		return this.type;
	}

	/**
	 * 设置布尔类型参数
	 * 
	 * @param result
	 *            待设置的新参数
	 * @author alonso lee
	 */
	public void setBoolean(boolean result) {
		this.result = result;
	}

	/**
	 * 获取布尔类型参数值
	 * 
	 * @return 布尔类型参数值
	 * @author alonso lee
	 */
	public boolean getBoolean() {
		return this.result;
	}

	/**
	 * 设定服务器下发的响应码
	 * 
	 * @param code
	 * @author alonso lee
	 */
	public void setResponseCode(int code) {
		this.responsCode = code;
	}

	/**
	 * 获取服务器下发的响应码
	 * 
	 * @return
	 * @author alonso lee
	 */
	public int getResponseCode() {
		return this.responsCode;
	}

	/**
	 * 设置jid
	 * 
	 * @param jid
	 * @author alonso lee
	 */
	public void setJid(String jid) {
		this.jid = jid;
	}

	/**
	 * 获取jid
	 * 
	 * @return
	 * @author alonso lee
	 */
	public String getJid() {
		return this.jid;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getPwd() {
		return this.pwd;
	}

	/**
	 * @param token the token to set
	 */
	public void setToken(String token) {
		this.token = token;
	}
	
	/**
	 * @return the token
	 */
	public String getToken() {
		return token;
	}
	
	public void setNewConnectionState(ALXmppConnectionState state) {
		this.newConnectionState = state;
	}

	public ALXmppConnectionState getNewConnectionState() {
		return this.newConnectionState;
	}

	public void setLastConnectionState(ALXmppConnectionState state) {
		this.lastConnectionState = state;
	}

	public ALXmppConnectionState getLastConnectionState() {
		return this.lastConnectionState;
	}

	public void setErrorMessage(String errorMessage) {
		if (errorMessage != null) {
			this.errorMessage = errorMessage;
		}
	}

	public String getErrorMessage() {
		return this.errorMessage;
	}

	public void setMessage(ALMessage msg) {
		this.msg = msg;
	}

	public ALMessage getMessage() {
		return msg;
	}

	/**
	 * @param conflictId
	 *            the conflictId to set
	 */
	public void setConflictId(String conflictId) {
		this.conflictId = conflictId;
	}

	/**
	 * @return the conflictId
	 */
	public String getConflictId() {
		return conflictId;
	}

	/**
	 * @param curXmppSessionId the curXmppSessionId to set
	 */
	public void setCurXmppSessionId(String curXmppSessionId) {
		this.curXmppSessionId = curXmppSessionId;
	}
	
	/**
	 * @return the curXmppSessionId
	 */
	public String getCurXmppSessionId() {
		return curXmppSessionId;
	}
	
	/**
	 * @param data the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}
	
	/**
	 * @return the data
	 */
	public Object getData() {
		return data;
	}

	public int getIntData() {
		return intData;
	}

	public void setIntData(int intData) {
		this.intData = intData;
	}

	public String getStrData1() {
		return strData1;
	}

	public void setStrData1(String strData1) {
		this.strData1 = strData1;
	}

	public String getStrData2() {
		return strData2;
	}

	public void setStrData2(String strData2) {
		this.strData2 = strData2;
	}
	
	/**
	 * @param strData3 the strData3 to set
	 */
	public void setStrData3(String strData3) {
		this.strData3 = strData3;
	}
	
	/**
	 * @return the strData3
	 */
	public String getStrData3() {
		return strData3;
	}
	
	
	
}
